import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
//import path from "path";
import AutoImport from 'unplugin-auto-import/vite';

export default defineConfig({
  server: {
    host: "0.0.0.0",
    port: 9000,
    strictPort: true,
    hmr: true,
    proxy: {
      "/api": {
        target: "https://api.douban.com",
        changeOrigin: true,
        rewrite: (path: string) => path.replace(/^\/api/, ""),
      },
    },
  },
  resolve: {
    alias: {
      "@": "/src"
      //path.resolve(__dirname, "./src"),
    },
  },
  plugins: [
    vue(),
    AutoImport({
      imports: [
        'vue',
        'vue-router', // 如果你使用了 Vue Router
        // 其他需要的模块
      ],
      dts: 'src/auto-imports.d.ts', // 生成类型声明文件
    }),
  ],
});